[#include "/WEB-INF/pages/common/taglibs.ftl"]
[@c.url var="backUrl" value="/manage/ArticleComment_list.action" scope="page"][/@c.url]
[#assign renderTo="#articleCommentTableList"]
[#macro _script]
	<script type="text/javascript" src="[@c.url value='/js/plugins/jquery.alerts.js'/]"></script>
	<script type="text/javascript">
		var base = (function(){
			// 事件绑定
			function _addEventListeners() {
				// 维护
				$('a[act=edit]').unbind('click').click(function(){
					var id = $(this).parent().attr('tval');
					[@c.url var="editUrl" value='/manage/ArticleComment_edit.action' scope="page"]
					[/@c.url]
					var _form = $('<form action="${editUrl}" method="get"><input type="hidden" name="id" value="'+ id +'"/></form>').prependTo(document.body);
					_form.submit();
					//var url = "${editUrl}&id=" + id;
					//$.get(url, {'id':id, 'ajax':'true'}, function(data) {
					//	$('#body').html(data);
					//})
					//window.location = url;
				})
				
				// 删除
				$('a[act=delete]').unbind('click').click(function(){
					var id = $(this).parent().attr('tval');
					var title = $('#delete-confirm').attr('title');
					var content = $('#delete-confirm').html();
					jConfirm(content, title, function(r) {
						if (r) {
							[@c.url	var="deleteUrl" value='/manage/ArticleComment_delete.action' scope="page"]
								[@c.param name="backUrl" value="${backUrl}"/]
							[/@c.url]
							
							var _form = $('<form action="${deleteUrl}" method="get"><input type="hidden" name="id" value="'+ id +'"/></form>').prependTo(document.body);
							_form.submit();
							//window.location	= "${deleteUrl}" + id;
						}
					});
					return false;
				})
			};
			return {
                config: {
                	url : null,
                    theme: null
                },
                init: function () {
                    _addEventListeners();
                }
			}
		}());
		
		$(function(){
			var link = "[@c.url value='/manage/ArticleComment_list.action?currentPage=${currentPage}' /]";
			base.config.theme = getTheme();
			base.config.url = link;
            //Initializing the form
			base.init();
		})
	</script>
[/#macro]

[#macro _content]
	[@demo.tableDisplayer id="articleCommentTable" ajaxPage="true" renderTo="${renderTo}" property="articleCommentList" pagesize=4 sort="true" page="/manage/ArticleComment_list.action" name="FreemarkerTable" config="/WEB-INF/component/table/template-stdtable-sort.ftl" bundle="messageSource"]
		[@demo.column name="id" property="id" title="ID" headerClass="" columnClass="span-tiny center" sortable="true"/]
		[@demo.column name="title" property="title" title="标题" columnClass="" sortable="true"/]
		[@demo.column name="sendName" property="sendName" title="昵称" columnClass="span1-1" sortable="true"/]
		[@demo.column name="sendRegion" property="sendRegion" title="所在地区" columnClass="span2" sortable="true"/]
		[@demo.column name="ipAddress" property="ipAddress" title="ip地址" columnClass="span1" sortable="true"/]
		[@demo.column name="createDate" property="createDate" title="评论时间" columnClass="span1-1" sortable="true"/]
		[@demo.column name="type" property="type" title="类型" columnClass="span1" sortable="true"/]
		[@demo.column name="operate" property="id" title="操作" innerHtml="\la href='javascript:void(0);' act='edit' \g编辑\l/a\g&nbsp;|&nbsp;\la href='javascript:void(0);' act='delete' \g删除\l/a\g" headerClass="batch span1"/]
	[/@demo.tableDisplayer]
	<div id="delete-confirm" style="display:none" title="评论删除">
		<p>评论删除后将无法恢复.您确认删除吗？</p>
	</div>
[/#macro]

[#if piece==true]
		[@_script /]
		<!--设置提交行为-->
		[#assign act="save" /]
		<!--设置table渲染到指定ID节点-->
		[@_content /]
[#else]
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Insert title here</title>
		<meta name="menu" content="AdminMenu"/>
		<meta name="heading" content="heading"/>
		[@_script /]
	</head>
	<body id="body">
		<div class="contenttitle">
    		<h2 id="vertical" class="form"><span>配置编辑</span></h2>
	    </div><!--contenttitle-->
		[@_content /]
	</body>
	</html>
[/#if]